package com.ruoyi.project.jiaqin.advertising.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.jiaqin.advertising.mapper.AdvertisingMapper;
import com.ruoyi.project.jiaqin.advertising.domain.Advertising;
import com.ruoyi.project.jiaqin.advertising.service.IAdvertisingService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 广告投放Service业务层处理
 *
 * @author admin
 * @date 2021-01-11
 */
@Service
public class AdvertisingServiceImpl implements IAdvertisingService
{
    @Autowired
    private AdvertisingMapper advertisingMapper;

    /**
     * 查询广告投放
     *
     * @param id 广告投放ID
     * @return 广告投放
     */
    @Override
    public Advertising selectAdvertisingById(String id)
    {
        return advertisingMapper.selectAdvertisingById(id);
    }

    /**
     * 查询广告投放列表
     *
     * @param advertising 广告投放
     * @return 广告投放
     */
    @Override
    public List<Advertising> selectAdvertisingList(Advertising advertising)
    {
        return advertisingMapper.selectAdvertisingList(advertising);
    }

    /**
     * 新增广告投放
     *
     * @param advertising 广告投放
     * @return 结果
     */
    @Override
    public int insertAdvertising(Advertising advertising)
    {
        advertising.setId(UUID.randomUUID().toString().replace("-",""));
        return advertisingMapper.insertAdvertising(advertising);
    }

    /**
     * 修改广告投放
     *
     * @param advertising 广告投放
     * @return 结果
     */
    @Override
    public int updateAdvertising(Advertising advertising)
    {
        return advertisingMapper.updateAdvertising(advertising);
    }

    /**
     * 删除广告投放对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdvertisingByIds(String ids)
    {
        return advertisingMapper.deleteAdvertisingByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除广告投放信息
     *
     * @param id 广告投放ID
     * @return 结果
     */
    @Override
    public int deleteAdvertisingById(String id)
    {
        return advertisingMapper.deleteAdvertisingById(id);
    }
}
